package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by hedepu on 2017-08-30
 */

public class OrderSelectSubmitSelectApi extends BaseApi {
    private String session;
    private String storeId;
    private String ownerCarId;
    private String storeServices;
    private String serviceTime;
    private String note;
    private String goodsPackageItems;
    private String servicePackageItems;

    private String userPackageItems;


    public OrderSelectSubmitSelectApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setShowProgress(true);
        setCache(true);
        setMothed(UserHelper.getInstance().getUserAccount() + Constants.OWN_ORDER_RESERVATIONSERVICE);//相当于缓存保存的Key
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效
        setCookieNoNetWorkTime(0);//无网缓存7天
    }


    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getOwnerCarId() {
        return ownerCarId;
    }

    public void setOwnerCarId(String ownerCarId) {
        this.ownerCarId = ownerCarId;
    }

    public String getStoreServices() {
        return storeServices;
    }

    public void setStoreServices(String storeServices) {
        this.storeServices = storeServices;
    }

    public String getServiceTime() {
        return serviceTime;
    }

    public void setServiceTime(String serviceTime) {
        this.serviceTime = serviceTime;
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getGoodsPackageItems() {
        return goodsPackageItems;
    }

    public void setGoodsPackageItems(String goodsPackageItems) {
        this.goodsPackageItems = goodsPackageItems;
    }

    public String getServicePackageItems() {
        return servicePackageItems;
    }

    public void setServicePackageItems(String servicePackageItems) {
        this.servicePackageItems = servicePackageItems;
    }

    public String getUserPackageItems() {
        return userPackageItems;
    }

    public void setUserPackageItems(String userPackageItems) {
        this.userPackageItems = userPackageItems;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.getReservationService(getSession(), getStoreId(), getOwnerCarId(), getStoreServices(), getServiceTime(), getNote(), getUserPackageItems());
    }
}
